<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="servlets.*" %>
<%
    ProductsProvider productsProvider = new ProductsProvider();
    Product[] items = (Product[]) productsProvider.getProducts();
    out.print("[");
    for(int i=0; i < items.length; i++)
    {
        if(i > 0)
            out.print(",");

        out.print("{");

        Product product = items[i];
        out.print("\"id\":\"" + product.getId() + "\", \"name\":\"" + product.getTitle() + "\"");

        out.print("}");
    }
    out.print("]");
%>